package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.Map;

@Mapper
public interface UserMapper {


    /**
     * 根据id查询用户
     *
     * @param openid
     * @return
     */
    @Select("select *from user where openid=#{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     */
//    @Insert("insert into user(name,age) values (#{name},#{age})")
//    @Options(useGeneratedKeys = true,keyProperty = "id")
    void insert(User user);
    @Delete("delete from user")
    void deleteAll();

    @Select("select * from user where id = #{id}")
    User getById(Long id);

    /**
     * 用户数量统计
     *
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
